home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / os20 / util / random.readme < prev    next >
Text File  |  1992-12-07  |  2KB  |  52 lines

  1. Short: Choose file randomly (for e.g. WB picture)
  2.  
  3. Random
  4. ------
  5. Note: Random requires OS2.0 or above.
  6.  
  7. Bored with the same old Workbench picture/pattern/palette etc. at
  8. boot-time? Wish you could boot up with a preference selected randomly from
  9. your favourites? Then you need...Random.
  10.  
  11. Random was designed with the above in mind, but could probably be applied
  12. to all sorts of (un)useful situations.
  13.  
  14. Random takes one option, a pattern to match. It finds all files that match
  15. the pattern, and echos one 'randomly'. The randomness is done by
  16. calculating the system time in seconds and taking the remainder on division
  17. by the number of matching files. So, Random run quickly in succession will
  18. not produce a random sequence, but it does when run over a sequence of
  19. boots (don't ask me for a proof, though).
  20.  
  21. For example, I use NickPrefs to put a picture on my Workbench, and for each
  22. of my pictures, have created a 'Preset' file using the WBPicture
  23. preferences editor. Let's say I put them all in the sys:prefs/presets
  24. drawer, giving each a '.wbpic' extension.
  25.  
  26. I can then get NickPrefs to use one randomly by using backtick
  27. substitution, adding the following line to my Startup-sequence:
  28.  
  29.     copy `random sys:prefs/presets/#?.wbpic` env:sys/wbpicture.prefs
  30.          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  31.            inserts randomly selected file
  32.  
  33. immediately AFTER the line that looks a bit like
  34.  
  35.     copy >NIL: ENVARC: ram:env all quiet noreq
  36.  
  37. This procedure could be modified for any other prefs file, and other things
  38. too.
  39.  
  40. Placed in the public domain, with source in SAS C (v5.10), and with NO
  41. WARRANTIES attached. If you want enhancements made to Random, try to do
  42. them yourself first before asking me (I'm a busy man...). I do find time to
  43. read fan mail, though :)
  44.  
  45. Finally, there aren't enough uploads of pictures suitable for
  46. backdrops/tiling; if you've got some decent ones, share them!
  47.  
  48. You have been listening to...
  49.  
  50.     Martin Scott    email: mws@castle.ed.ac.uk  'til June 1993
  51.     December '92
  52.